package com.chenailin.www.model.enums;

/**
 * @author evi
 */
public enum EnterpriseRole {
    OWNER(1, "所有者"),
    ADMIN(2, "管理员"),
    MEMBER(3, "成员");

    public final int code;
    public final String desc;

    EnterpriseRole(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static EnterpriseRole getByCode(int code) {
        for (EnterpriseRole role : EnterpriseRole.values()) {
            if (role.getCode() == code) {
                return role;
            }
        }
        return null;
    }
}